<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        // RegExp

        var reg1 = new RegExp("^\\w{6,10}$")
        var reg2 = /^\w{6,8}$/;


        var str = "usernamefsdfsdfsdfsdfsdf";

        let test = reg1.test(str);
        let test1 = reg2.test(str);
        // alert(test);
        // alert(test1);


        //匹配手机号
        /*
            var reg3 = /^1[3-9][0-9]{9}/;
            reg3 = /^1[3-9][0-9]{9}/
            reg3 = /^1[3-9][0-9]{9}/
         */
        let reg3 = /^1[3-9][0-9]{9}$/;

        var phoneNumber="14393849488";
        let test9 = reg3.test(phoneNumber);
        console.log(test9);


        /*
                验证邮箱
                suiyi .lsdfj @ ljfsdjf .con .cn
                ^\w+  (\.\w+)* @ \w  \.[A-z]{1,5}
         */


        var email = "21312312312312@qq.com.cn";

        reg3 = /^\w{3,}(\.\w+)*@[A-z0-9]+(\.[A-z]{2,5}){1,2}$/;

        console.log(reg3.test(email));


        reg3 = /^\w{3,}(\.\w+)*@[A-z0-9]{2,}(\.[A-z]{2,5}){1,2}/;
        var email2 = "llf3l3ljljlf.jfdkfldgmail.com.cn"

        console.log(reg3.test(email2));








    </script>
</head>
<body>

</body>
</html>